home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / misc / db3.6-beta / db3.6-beta-src / toolbox.c < prev    next >
C/C++ Source or Header  |  1999-11-30  |  16KB  |  349 lines

  1. /* Images for the toolbox */
  2.  
  3. #include "toolbox.h"
  4. #include "dbGUI.h"
  5. #include <proto/intuition.h>
  6.  
  7. #define LATER 0
  8.  
  9. extern Class *TextFieldClass;
  10.  
  11.  
  12. UWORD __chip CheckBoxIData[] =
  13. {
  14. /* Plane 0 */
  15.     0x0000,0x0000,0x0040,0x0000,0x0000,0x00C0,0x0000,0x0000,
  16.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  17.     0x0000,0x00C0,0x0000,0x0000,0x20C0,0x0000,0x0000,0x60C0,
  18.     0x0000,0x0000,0x60C0,0x0000,0x0000,0x60C0,0x0000,0x0078,
  19.     0x60C0,0x0000,0x00C0,0x60C0,0x0000,0x00C0,0x60C0,0x0000,
  20.     0x0180,0x60C0,0x0000,0x0180,0x60C0,0x0001,0xC300,0x60C0,
  21.     0x0000,0xC200,0x60C0,0x0000,0xE600,0x60C0,0x0000,0x6400,
  22.     0x60C0,0x0000,0x7C00,0x60C0,0x0000,0x3800,0x60C0,0x0000,
  23.     0x0000,0x60C0,0x0000,0x0000,0x60C0,0x0000,0x0000,0x60C0,
  24.     0x00FF,0xFFFF,0xE0C0,0x0000,0x0000,0x00C0,0x0000,0x0000,
  25.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  26.     0x0000,0x00C0,0x7FFF,0xFFFF,0xFFC0,
  27. /* Plane 1 */
  28.     0xFFFF,0xFFFF,0xFF80,0xC000,0x0000,0x0000,0xC000,0x0000,
  29.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  30.     0x0000,0x0000,0xC1FF,0xFFFF,0xC000,0xC180,0x0000,0x0000,
  31.     0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,
  32.     0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,
  33.     0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,
  34.     0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,
  35.     0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,
  36.     0x0000,0x0000,0xC180,0x0000,0x0000,0xC180,0x0000,0x0000,
  37.     0xC100,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,
  38.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  39.     0x0000,0x0000,0x8000,0x0000,0x0000,
  40. };
  41.  
  42. struct Image CheckBoxI =
  43. {
  44.     0, 0,                       /* Upper left corner */
  45.     TBGadW, TBGadH, 2,                  /* Width, Height, Depth */
  46.     CheckBoxIData,              /* Image data */
  47.     0x0003, 0x0000,             /* PlanePick, PlaneOnOff */
  48.     NULL                        /* Next image */
  49. };
  50.  
  51.  
  52. UWORD __chip CycleIData[] =
  53. {
  54. /* Plane 0 */
  55.     0x0000,0x0000,0x0040,0x0000,0x0000,0x00C0,0x0000,0x0000,
  56.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  57.     0x0000,0x00C0,0x0000,0x0000,0x20C0,0x0000,0x0000,0x60C0,
  58.     0x0003,0xF810,0x60C0,0x0006,0x0C10,0x60C0,0x0006,0x0C10,
  59.     0x60C0,0x0006,0x3F10,0x60C0,0x0006,0x1E10,0x60C0,0x0006,
  60.     0x0C10,0x60C0,0x0006,0x0010,0x60C0,0x0006,0x0010,0x60C0,
  61.     0x0006,0x0010,0x60C0,0x0006,0x0010,0x60C0,0x0006,0x0010,
  62.     0x60C0,0x0006,0x0010,0x60C0,0x0006,0x0C10,0x60C0,0x0003,
  63.     0xF810,0x60C0,0x0000,0x0010,0x60C0,0x0000,0x0000,0x60C0,
  64.     0x00FF,0xFFFF,0xE0C0,0x0000,0x0000,0x00C0,0x0000,0x0000,
  65.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  66.     0x0000,0x00C0,0x7FFF,0xFFFF,0xFFC0,
  67. /* Plane 1 */
  68.     0xFFFF,0xFFFF,0xFF80,0xC000,0x0000,0x0000,0xC000,0x0000,
  69.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  70.     0x0000,0x0000,0xC1FF,0xFFFF,0xC000,0xC180,0x0000,0x0000,
  71.     0xC180,0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,0x0008,
  72.     0x0000,0xC180,0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,
  73.     0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,0x0008,0x0000,
  74.     0xC180,0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,0x0008,
  75.     0x0000,0xC180,0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,
  76.     0x0008,0x0000,0xC180,0x0008,0x0000,0xC180,0x0000,0x0000,
  77.     0xC100,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,
  78.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  79.     0x0000,0x0000,0x8000,0x0000,0x0000,
  80. };
  81.  
  82. struct Image CycleI =
  83. {
  84.     0, 0,                       /* Upper left corner */
  85.     TBGadW, TBGadH, 2,                  /* Width, Height, Depth */
  86.     CycleIData,         /* Image data */
  87.     0x0003, 0x0000,             /* PlanePick, PlaneOnOff */
  88.     NULL                        /* Next image */
  89. };
  90.  
  91.  
  92. UWORD __chip StringIData[] =
  93. {
  94. /* Plane 0 */
  95.     0x0000,0x0000,0x0040,0x0000,0x0000,0x00C0,0x0000,0x0000,
  96.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  97.     0x0000,0x00C0,0x0000,0x0000,0x20C0,0x00FF,0xFFFF,0x60C0,
  98.     0x00C0,0x0000,0x60C0,0x00C0,0x0000,0x60C0,0x00C3,0xC400,
  99.     0x60C0,0x00C4,0x2400,0x60C0,0x00C4,0x0EA0,0x60C0,0x00C3,
  100.     0x04C0,0x60C0,0x00C0,0xC480,0x60C0,0x00C0,0x2480,0x60C0,
  101.     0x00C4,0x2480,0x60C0,0x00C4,0x2480,0x60C0,0x00C3,0xC680,
  102.     0x60C0,0x00C0,0x0000,0x60C0,0x00C0,0x0000,0x60C0,0x00C0,
  103.     0x0000,0x60C0,0x00C0,0x0000,0x60C0,0x0080,0x0000,0x60C0,
  104.     0x01FF,0xFFFF,0xE0C0,0x0000,0x0000,0x00C0,0x0000,0x0000,
  105.     0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  106.     0x0000,0x00C0,0x7FFF,0xFFFF,0xFFC0,
  107. /* Plane 1 */
  108.     0xFFFF,0xFFFF,0xFF80,0xC000,0x0000,0x0000,0xC000,0x0000,
  109.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  110.     0x0000,0x0000,0xC3FF,0xFFFF,0xC000,0xC300,0x0000,0x8000,
  111.     0xC300,0x0001,0x8000,0xC300,0x0001,0x8000,0xC300,0x0001,
  112.     0x8000,0xC300,0x0001,0x8000,0xC300,0x0001,0x8000,0xC300,
  113.     0x0001,0x8000,0xC300,0x0001,0x8000,0xC300,0x0001,0x8000,
  114.     0xC300,0x0001,0x8000,0xC300,0x0001,0x8000,0xC300,0x0001,
  115.     0x8000,0xC300,0x0001,0x8000,0xC300,0x0001,0x8000,0xC300,
  116.     0x0001,0x8000,0xC300,0x0001,0x8000,0xC37F,0xFFFF,0x8000,
  117.     0xC200,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,
  118.     0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  119.     0x0000,0x0000,0x8000,0x0000,0x0000,
  120. };
  121.  
  122. struct Image StringI =
  123. {
  124.     0, 0,                       /* Upper left corner */
  125.     TBGadW, TBGadH, 2,                  /* Width, Height, Depth */
  126.     StringIData,                /* Image data */
  127.     0x0003, 0x0000,             /* PlanePick, PlaneOnOff */
  128.     NULL                        /* Next image */
  129. };
  130.  
  131.  
  132. UWORD __chip TextIData[] =
  133. {
  134.                 /* Plane 0 */
  135.                 0x0000,0x0000,0x0040,0x0000,0x0000,0x00C0,0x0000,0x0000,
  136.                 0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  137.                 0x0000,0x00C0,0x03FF,0xFFFF,0xC0C0,0x0300,0x0000,0x00C0,
  138.                 0x0300,0x0000,0x00C0,0x0300,0x0000,0x00C0,0x0300,0x0000,
  139.                 0x00C0,0x033F,0x8010,0x00C0,0x0304,0x0010,0x00C0,0x0304,
  140.                 0x2138,0x00C0,0x0304,0x1210,0x00C0,0x0304,0x0C10,0x00C0,
  141.                 0x0304,0x0C10,0x00C0,0x0304,0x1210,0x00C0,0x0304,0x2110,
  142.                 0x00C0,0x0304,0x2118,0x00C0,0x0300,0x0000,0x00C0,0x0300,
  143.                 0x0000,0x00C0,0x0300,0x0000,0x00C0,0x0300,0x0000,0x00C0,
  144.                 0x0200,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,
  145.                 0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  146.                 0x0000,0x00C0,0x7FFF,0xFFFF,0xFFC0,
  147.                 /* Plane 1 */
  148.                 0xFFFF,0xFFFF,0xFF80,0xC000,0x0000,0x0000,0xC000,0x0000,
  149.                 0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  150.                 0x0000,0x0000,0xC000,0x0000,0x2000,0xC000,0x0000,0x6000,
  151.                 0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,
  152.                 0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,
  153.                 0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,
  154.                 0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,
  155.                 0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,
  156.                 0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,
  157.                 0xC1FF,0xFFFF,0xE000,0xC000,0x0000,0x0000,0xC000,0x0000,
  158.                 0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  159.                 0x0000,0x0000,0x8000,0x0000,0x0000
  160. };
  161.  
  162. struct Image TextI =
  163. {
  164.     0, 0,                       /* Upper left corner */
  165.     TBGadW, TBGadH, 2,                  /* Width, Height, Depth */
  166.     TextIData,          /* Image data */
  167.     0x0003, 0x0000,             /* PlanePick, PlaneOnOff */
  168.     NULL                        /* Next image */
  169. };
  170.  
  171.  
  172.  
  173.  
  174. UWORD __chip TextFieldIData[] =
  175. {
  176.                 /* Plane 0 */
  177.                 0x0000,0x0000,0x0040,0x0000,0x0000,0x00C0,0x0000,0x0000,
  178.                 0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  179.                 0x0000,0x00C0,0x03FF,0xFFFF,0xC0C0,0x0300,0x0000,0x00C0,
  180.                 0x0300,0x0000,0x00C0,0x033E,0x0010,0x00C0,0x0308,0x0010,
  181.                 0x00C0,0x0308,0x64B8,0x00C0,0x0308,0xB310,0x00C0,0x0308,
  182.                 0x8310,0x00C0,0x0308,0x6488,0x00C0,0x0300,0x0000,0x00C0,
  183.                 0x033E,0x0010,0x00C0,0x0308,0x0010,0x00C0,0x0308,0x64B8,
  184.                 0x00C0,0x0308,0xB310,0x00C0,0x0308,0x8310,0x00C0,0x0308,
  185.                 0x6488,0x00C0,0x0300,0x0000,0x00C0,0x0300,0x0000,0x00C0,
  186.                 0x0200,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,
  187.                 0x00C0,0x0000,0x0000,0x00C0,0x0000,0x0000,0x00C0,0x0000,
  188.                 0x0000,0x00C0,0x7FFF,0xFFFF,0xFFC0,
  189.                 /* Plane 1 */
  190.                 0xFFFF,0xFFFF,0xFF80,0xC000,0x0000,0x0000,0xC000,0x0000,
  191.                 0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  192.                 0x0000,0x0000,0xC000,0x0000,0x2000,0xC000,0x0000,0x6000,
  193.                 0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,
  194.                 0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,
  195.                 0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,
  196.                 0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,
  197.                 0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,
  198.                 0x0000,0x6000,0xC000,0x0000,0x6000,0xC000,0x0000,0x6000,
  199.                 0xC1FF,0xFFFF,0xE000,0xC000,0x0000,0x0000,0xC000,0x0000,
  200.                 0x0000,0xC000,0x0000,0x0000,0xC000,0x0000,0x0000,0xC000,
  201.                 0x0000,0x0000,0x8000,0x0000,0x0000
  202. };
  203.  
  204. struct Image TextFieldI =
  205. {
  206.     0, 0,                       /* Upper left corner */
  207.     TBGadW, TBGadH, 2,                  /* Width, Height, Depth */
  208.     TextFieldIData,             /* Image data */
  209.     0x0003, 0x0000,             /* PlanePick, PlaneOnOff */
  210.     NULL                        /* Next image */
  211. };
  212.  
  213.  
  214.  
  215. struct Gadget ToolBoxGadgets[] = {
  216.         {
  217.         /* CHECKBOX */
  218.  
  219.                 NULL, LATER, LATER,
  220.                 TBGadW, TBGadH,
  221.                 GFLG_GADGHCOMP|GFLG_GADGIMAGE,          /* Flags */
  222.                 GACT_RELVERIFY,         /* Activation */
  223.                 GTYP_BOOLGADGET,                /* GadgetType */
  224.                 &CheckBoxI,                             /* GadgetRender */
  225.                 NULL,                                           /* SelectRender */
  226.                 NULL,                                           /* GadgetText */
  227.                 0,                                                      /* MutualExclude */
  228.                 NULL,                                           /* SpecialInfo */
  229.                 CheckBoxID,                             /* GadgetID */
  230.                 NULL                                            /* UserData */
  231.         },
  232.  
  233.         {
  234.         /* CYCLE */
  235.  
  236.                 &ToolBoxGadgets[CheckBoxID], LATER, LATER,
  237.                 TBGadW, TBGadH,
  238.                 GFLG_GADGHCOMP|GFLG_GADGIMAGE,          /* Flags */
  239.                 GACT_RELVERIFY,         /* Activation */
  240.                 GTYP_BOOLGADGET,                /* GadgetType */
  241.                 &CycleI,                                        /* GadgetRender */
  242.                 NULL,                                           /* SelectRender */
  243.                 NULL,                                           /* GadgetText */
  244.                 0,                                                      /* MutualExclude */
  245.                 NULL,                                           /* SpecialInfo */
  246.                 CycleID,                                        /* GadgetID */
  247.                 NULL                                            /* UserData */
  248.         },
  249.  
  250.  
  251.         {
  252.         /* STRING */
  253.  
  254.                 &ToolBoxGadgets[CycleID], LATER, LATER,
  255.                 TBGadW, TBGadH,
  256.                 GFLG_GADGHCOMP|GFLG_GADGIMAGE,          /* Flags */
  257.                 GACT_RELVERIFY,         /* Activation */
  258.                 GTYP_BOOLGADGET,                /* GadgetType */
  259.                 &StringI,                               /* GadgetRender */
  260.                 NULL,                                           /* SelectRender */
  261.                 NULL,                                           /* GadgetText */
  262.                 0,                                                      /* MutualExclude */
  263.                 NULL,                                           /* SpecialInfo */
  264.                 StringID,                               /* GadgetID */
  265.                 NULL                                            /* UserData */
  266.         },
  267.  
  268.         {
  269.         /* TEXT */
  270.  
  271.                 &ToolBoxGadgets[StringID], LATER, LATER,
  272.                 TBGadW, TBGadH,
  273.                 GFLG_GADGHCOMP|GFLG_GADGIMAGE,          /* Flags */
  274.                 GACT_RELVERIFY,         /* Activation */
  275.                 GTYP_BOOLGADGET,                /* GadgetType */
  276.                 &TextI,                         /* GadgetRender */
  277.                 NULL,                                           /* SelectRender */
  278.                 NULL,                                           /* GadgetText */
  279.                 0,                                                      /* MutualExclude */
  280.                 NULL,                                           /* SpecialInfo */
  281.                 TextID,                         /* GadgetID */
  282.                 NULL                                            /* UserData */
  283.         },
  284.  
  285.         {
  286.         /* TEXTFIELD */
  287.  
  288.                 &ToolBoxGadgets[TextID], LATER, LATER,
  289.                 TBGadW, TBGadH,
  290.                 GFLG_GADGHCOMP|GFLG_GADGIMAGE,          /* Flags */
  291.                 GACT_RELVERIFY,                                         /* Activation */
  292.                 GTYP_BOOLGADGET,                                        /* GadgetType */
  293.                 &TextFieldI,                                            /* GadgetRender */
  294.                 NULL,                                                           /* SelectRender */
  295.                 NULL,                                                           /* GadgetText */
  296.                 0,                                                                      /* MutualExclude */
  297.                 NULL,                                                           /* SpecialInfo */
  298.                 TextFieldID,                                            /* GadgetID */
  299.                 NULL                                                            /* UserData */
  300.         }
  301.  
  302. };
  303.  
  304.  
  305. void CloseToolBox(struct Window *win)
  306. {
  307.         CloseWindow(win);
  308. }
  309.  
  310. struct Window *OpenToolBox(struct Window *parent)
  311. {
  312.         struct Window *win;
  313.  
  314.         ToolBoxGadgets[StringID].LeftEdge = OffX;
  315.         ToolBoxGadgets[StringID].TopEdge = OffY;
  316.  
  317.         ToolBoxGadgets[TextID].LeftEdge = OffX;
  318.         ToolBoxGadgets[TextID].TopEdge = OffY + 1*TBGadH;
  319.  
  320.         ToolBoxGadgets[TextFieldID].LeftEdge = OffX;
  321.         ToolBoxGadgets[TextFieldID].TopEdge = OffY + 2*TBGadH;
  322.                 /* Disable TextField is needed */
  323.         if(!TextFieldClass)
  324.                         {
  325.                         ToolBoxGadgets[TextFieldID].Flags |= GFLG_DISABLED;
  326.                         }
  327.  
  328.  
  329.         ToolBoxGadgets[CycleID].LeftEdge = OffX;
  330.         ToolBoxGadgets[CycleID].TopEdge = OffY + 3*TBGadH;
  331.  
  332.         ToolBoxGadgets[CheckBoxID].LeftEdge = OffX;
  333.         ToolBoxGadgets[CheckBoxID].TopEdge = OffY + 4*TBGadH;
  334.         
  335.         win = OpenWindowTags( NULL,
  336.                                 WA_Left,           parent->LeftEdge + parent->Width+32,
  337.                                 WA_Top,         parent->TopEdge,
  338.                                 WA_Width,       OffX + TBGadW + Scr->WBorRight,
  339.                                 WA_Height,      OffY + 5*TBGadH + Scr->WBorBottom,
  340.                                 WA_IDCMP,       IDCMP_GADGETUP,
  341.                                 WA_Flags,       WFLG_NEWLOOKMENUS|WFLG_RMBTRAP|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_SMART_REFRESH,
  342.                                 WA_Gadgets,     &ToolBoxGadgets[TextFieldID],
  343.                                 WA_ScreenTitle, parent->ScreenTitle,
  344.                                 WA_PubScreen,   Scr,
  345.                                 TAG_DONE );
  346.  
  347.         return win;
  348. }
  349.